package main

import "unicode/utf8"

func DismissSame(strs []string) []string {
	var i int
	for _, str := range strs {
		if i == 0 {
			strs[i] = str
			i++
			continue
		}
		if strs[i-1] != str {
			strs[i] = str
			i++
		}
	}
	return strs
}

func CheckCloseSpace(bts []byte) []byte {
	var i int
	for _, b := range bts {
		if i == 0 {
			bts[i] = b
			i++
			continue
		}
		if bts[i-1] != b || b != ' ' {
			bts[i] = b
			i++
			continue
		}
	}

	return bts
}

func ReverseByte(bts []byte) []byte {
	for i, j := 0, len(bts)-1; i < j; i, j = i+1, j-1 {
		bts[i], bts[j] = bts[j], bts[i]
	}

	for i := 0; i < len(bts); {
		_, size := utf8.DecodeRune(bts[i:])

		for j, k := 0, i+size-1; j < k; j, k = j+1, k-1 {
			bts[j], bts[k] = bts[k], bts[j]
		}
	}

	return bts
}

func main() {

}
